package com.aaa.controller;

import com.aaa.mapper.StudentMapper;
import com.aaa.pojo.Student;
import com.aaa.service.StudentService;
import com.aaa.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class StudentController {
    @Autowired
    private StudentService studentService;
    @GetMapping("findbycId/{cid}")
    public Result findbycId(@PathVariable Integer cid){
        return studentService.findbycId(cid);
    }
    @DeleteMapping("delete/{cid}")
    public Result delete(@PathVariable Integer cid){
        return studentService.delete(cid);
    }
    @GetMapping("findAll")
    public Result findAll(){
        return studentService.findAll();
    }
    @PutMapping("save")
    public Result save(Student student){
        return studentService.save(student);
    }
    @PutMapping("update")
    public Result update(@RequestBody Student student){
        return studentService.update(student);
    }
}
